package com.personal.service.icp.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.personal.dao.icp.AltcItemMapper;
import com.personal.entity.icp.AltcItem;
import com.personal.entity.icp.AltcItemExample;
import com.personal.service.icp.AltcItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AltcItemServiceImpl implements AltcItemService {

    @Resource
    private AltcItemMapper itemMapper;

    public List<AltcItem> getAll(){
        AltcItemExample example = new AltcItemExample();
        return itemMapper.selectByExample(example);
    }


    public PageInfo<AltcItem> getAllByPage(int page, int pageSize){
        PageHelper.startPage(page, pageSize);//底层实现原理采用改写语句(拦截器)
        List<AltcItem> list = itemMapper.getAllByPage();
        PageInfo<AltcItem> listItem = new PageInfo<>(list);
        return listItem;
    }
}
